//
//  ZFTXViewController.m
//  自定义collectionView
//
//  Created by apple on 15-1-14.
//  Copyright (c) 2015年 apple. All rights reserved.
//

#import "ZFTXViewController.h"
#import "UINavigationController+EMNavi.h"
@interface ZFTXViewController ()
{
    UIView * bgZFView;
}
@end

@implementation ZFTXViewController
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.view.backgroundColor = RGB(242, 242, 242);
    [self.navigationController setNavigationMode:EMNavigationModeDefault andSubMode:0];
    self.contentText = [[NSString alloc] init];
    self.titleText = [[NSString alloc] init];
    UIButton *button =[UIButton buttonWithType:UIButtonTypeCustom];
    button.frame=CGRectMake(0, 0, 30, 32);
    self.navigationItem.leftBarButtonItem =[[UIBarButtonItem alloc]initWithCustomView:button];
        


    self.title = self.titleText;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    bgZFView = [[UIView alloc]initWithFrame:CGRectMake(7,100 ,  __MainScreen_Width-14,250)];
    [self.view addSubview:bgZFView];
    bgZFView.layer.borderWidth = 0.5;
    bgZFView.layer.borderColor =RGB(59, 120, 38).CGColor;
    bgZFView.layer.cornerRadius = 5;
    bgZFView.backgroundColor = [UIColor whiteColor];
    
    UIImageView * imgView = [[UIImageView alloc]initWithFrame:CGRectMake(30, 40, 60, 60)];
    [bgZFView addSubview:imgView];
    imgView.image = [UIImage imageNamed:@"icon_购物车_支付成功"];
    
    float heigth = 40;
    UILabel * addrLab = [self UILabFrameOriginX:120 Y:heigth width:170 height:25];
    addrLab.text = @"沃佳鲜生提醒您:";
    addrLab.font = [UIFont fontWithName:HEITILIGHT size:16];
    
    UILabel * ddLab = [self UILabFrameOriginX:120 Y:heigth +=30 width:170 height:30];
    ddLab.text = self.contentText;
    ddLab.font = [UIFont fontWithName:HEITILIGHT size:19];
    ddLab.textColor = RGB(251, 109, 0);
    
    UIButton * editorBtn = [self UIBtnFrameOriginX:__MainScreen_Width/2-90 Y:180  width:160 height:40];
    [editorBtn setTitle:@"点击返回商城" forState:UIControlStateNormal];
    [editorBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    editorBtn.titleLabel.font = [UIFont systemFontOfSize:13];
    editorBtn.backgroundColor = RGB(93,164,64);
    [editorBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [editorBtn addTarget:self action:@selector(doBackFirstViewController) forControlEvents:UIControlEventTouchUpInside];
}

//btn要做的事情
-(void)doBackFirstViewController
{
    [self.navigationController popToRootViewControllerAnimated:YES];
}

-(UILabel *)UILabFrameOriginX:(float)x Y:(float)y width:(float)w height:(float)h
{
    UILabel * lab = [[UILabel alloc]initWithFrame:CGRectMake(x, y, w, h)];
    [bgZFView addSubview:lab];
    return lab;
}

-(UIButton *)UIBtnFrameOriginX:(float)x Y:(float)y width:(float)w height:(float)h
{
    UIButton * btn = [[UIButton alloc]initWithFrame:CGRectMake(x, y, w, h)];
    [bgZFView addSubview:btn];
    btn.layer.borderWidth = 0.5;
    btn.layer.borderColor =RGB(59, 120, 38).CGColor;
    btn.layer.cornerRadius = 5;
    return btn;
}

@end
